package com.yuyang.wifi.utils;

import android.text.TextUtils;
import android.widget.TextView;


/**
 * Created by yang on 2017/8/28.
 */

public class TextViewLimitLengthUtils {

    public static void setLimitText(TextView textView, String text, int length) {

        if (!TextUtils.isEmpty(text)) {
            if (text.length() <= length) {
                textView.setText(text);
            } else {
                String substring = text.substring(0, length);
                textView.setText(substring + "...");
            }
        }
    }

}
